Skip to main content

IF

Checks whether a condition is met, and returns one value if true, and another value if false.

Syntax

expression.IF(arg1, arg2, arg3);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequirednumberstringApiRange
arg2RequirednumberstringApiRange
arg3RequiredApiRangeApiNamenumber

Returns

number | string | boolean

Example

var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.IF("12<100", 0, 1));